<?php

namespace C\P;

use OSS;

class AliyunOSS
{
    private $accessKeyId;
    private $accessKeySecret;
    private $endpoint;
    private $client;

  /**
   * @param $accessKeyId
   * @param $accessKeySecret
   * @param $endpoint
   * @param $client
   */
    public function __construct($accessKeyId, $accessKeySecret, $endpoint)
    {
        $this->accessKeyId     = $accessKeyId;
        $this->accessKeySecret = $accessKeySecret;
        $this->endpoint        = $endpoint;
        $this->client = new OSS\OssClient(
            $this->accessKeyId,
            $this->accessKeySecret,
            $this->endpoint
        );
    }

  /**
   * @param $bucket string
   * @param $object string
   * @param $filePath string
   */
    public function upload($bucket, $object, $filePath)
    {
        return $this->client->uploadFile($bucket, $object, $filePath);
    }
}
